Programming the Commodore 64 again: Create a game step by step by Jens Christian Ingvartsen Thomsen
Author:Jens Christian Ingvartsen Thomsen [Thomsen, Jens Christian Ingvartsen]
Language: eng
Format: azw3
Published: 2021-01-16T00:00:00+00:00
#region Increment score
;**************************************************************************
;** Increment score
;**************************************************************************
IncrementScore
sed â â ;** Set decimal mode
clc â â ;** Clear carry flag
lda Score â ;** Load from score variable
adc #1 â ;** Add with carry value 1
sta Score â ;** Store in score variable
lda Score+1 â ;** Load from score variable + 1
adc #0 â ;** Add with carry value 0
sta Score+1 â ;** Store in score variable + 1
lda Score+2 â ;** Load from score variable + 2
adc #0 â ;** Add with carry value 0
sta Score+2 â ;** Store in score variable + 2
cld â â ;** Clear decimal mode
rts â â ;** Return
#endregion
#region Display lives
;**************************************************************************
;** Display lives
;**************************************************************************
DisplayLives
lda Lives â ;** Load from lives variable
sta Lives_Score â ;** Store in lives score variable
rts â â ;** Return
#endregion
#region Decrement lives
;**************************************************************************
;** Decrement lives
;************************************************************ **************
DecrementLives
ldx Lives â ;** Load from lives variable
dex â â ;** Decrement x register value with 1
stx Lives â ;** Store in lives variable
rts â â ;** Return
#endregion
#region Play explosion animation
;***************************************
;** Play explosion animation
;***************************************
PlayExplosionAnimation
ldx ExplosionIndex â ;** Load from explosion index variable
inx â â ;** Increment x register with 1
stx ExplosionIndex â ;** Store in explosion index variable
cpx #$8F â ;** Compare with value $8F
bne @continueExplosion â ;** Branch if not equal to @continueExplosion label
ldx #0 â â ;** Load value 0
stx ExplosionPlaying â ;** Store in explosion playing variable
stx SP2X â ;** Store in sprite 2 x position address
stx SP2Y â ;** Store in sprite 2 y position address
ldx #$8A â ;** Load value $8A
stx ExplosionIndex â ;** Store in explosion index variable
@continueExplosion
jsr SetCurrentExplosionSprite â ;** Gosub to set current explosion sprite
rts â â ;** Return
#endregion
#region Set current explosion sprite
;***************************************
;** Set current explosion sprite
;***************************************
SetCurrentExplosionSprite
PointToSpriteData ExplosionIndex, SSDP2 ;** Set current explosion sprite
rts â â ;** Return
#endregion
#region Set current portal sprite
;***************************************
;** Set current portal sprite
;***************************************
SetCurrentPortalSprite
PointToSpriteData PortalIndex, SSDP3 ;** Set current portal sprite
rts â â ;** Return
#endregion
#region Wait for explosion
;***************************************
;** Wait for explosion
;***************************************
WaitForExplosion
ldx #25 â ;** Load value 25
@waitExplosion1
ldy #255 â ;** Load value 255
@waitExplosion2
dey â â ;** Decrement y register with value 1
cpy #0 â ;** Compare with value 0
bne @waitExplosion2 â ;** Branch if not equal to @waitExplosion2 label
dex â â ;** Decrement x register with value 1
cpx #0 â ;** Compare with value 0
bne @waitExplosion1 â ;** Branch if not equal to @waitExplosion1 label
rts â â ;** Return
#endregion
#region Play explosion sound
;***************************************
;** Play explosion sound
;***************************************
PlayExplosionSound
lda #15 â ;** Load value 15
sta SIGVOL â ;** Store in volume register
lda #0 â â ;** Load value 0
sta FRELO1 â ;** Store in frequency low byte register
lda #30 â ;** Load value 30
sta FREHI1 â ;** Store in frequency hi byte register
lda #12 â ;** Load value 12
sta ATDCY1 â ;** Store in attack/decay register
lda #5 â â ;** Load value 5
sta SURELI â ;** Store in sustain/release register
lda #0 â â ;** Load value 0
sta VCREG1 â ;** Store in pulse waveform register
lda #129 â ;** Load value 129
sta VCREG1 â ;** Store in pulse waveform register
rts â â ;** Return
#endregion
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26587)
The Fifty Shades Trilogy & Grey by E L James(19076)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19055)
Shot Through the Heart by Mercy Celeste(18933)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17107)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16979)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16868)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16815)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16440)
The Subtle Art of Not Giving a F*ck by Mark Manson(14350)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14127)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13613)
Scorched Earth by Nick Kyme(12765)
Drei Generationen auf dem Jakobsweg by Stein Pia(10961)
Suna by Ziefle Pia(10886)
Scythe by Neal Shusterman(10333)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9518)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9364)
This is Going to Hurt by Adam Kay(9171)
